import * as actionTypes from "./constants";

const initialState = {
    count: 0,
}

function reducer(state = initialState, action) {
    switch (action.type) {
        case actionTypes.ADD_ACTION:
            return {...state, count: state.count + action.num}
        case actionTypes.SUB_ACTION:
            return {...state, count: state.count - action.num}
        default:
            return state;
    }
}

export default reducer;